<?php
/**
 * Created by JetBrains PhpStorm.
 * User: acumen
 * Date: 11/27/12
 * Time: 9:56 AM
 * To change this template use File | Settings | File Templates.
 */
if(!defined('BASEPATH')) exit('No direct script access allowed');
session_start();
class Home extends CI_Controller {
    function __construct() {
        parent::__construct();
    }

    function index() {
        if($this->session->userdata('logged_in')) {
            $session_data = $this->session->userdata('logged_in');
            $data['username'] = $session_data['username'];
            $this->load->view('home_view',$data);
        } else {
            // If no session, redirect to login page
            redirect('login','refresh');
        }
    }

    function logout() {
        $this->session->unset_userdata('logged_in');
        session_destroy();
        redirect('home','refresh');
        setcookie('UserCookie',"",-1);
    }
}
?>